import json

class ParsedCourse:
    def __init__(self, name: str, teacher: str, position: str, day: int, weeks: list[int], sections: list[int]):
        self.name = name
        self.teacher = teacher
        self.position = position
        self.day = day
        self.weeks = weeks
        self.sections = sections

class UploadCourseModel:
    def __init__(self, data: ParsedCourse, ct_id: int):
        self.ct_id = ct_id
        self.course = data

    def to_json(self):
        data =  {
          "ctId": self.ct_id,
          "course": {
            "name": self.course.name,
            "position": self.course.position,
            "teacher": self.course.teacher,
            "extend": "",
            "weeks": ",".join(str(i) for i in self.course.weeks),
            "day": self.course.day,
            "style": "{\"color\":\"#FF9900\",\"background\":\"#FCEBCD\"}",
            "sections": ",".join(str(i) for i in self.course.sections)
          },
          "sourceName": "course-app-miui"
        }
        return json.dumps(data)
